var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function s() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((s.prototype = i.prototype), new s()));
      };
    })(),
  WearableUsedDialog = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        (t.max = 50),
        (t.min = 1),
        (t.step = 1),
        (t.num = 1),
        (t.onLoadWearableSureDataFn = {
          caller: t,
          code: 2016,
          method: function (e) {
            ToastView.toastView(e.msg),
              WebSocketService.send({ c: 1425, d: { pageNum: 0 } }),
              WebSocketService.send({ c: 2015, d: { gid: t.gid, pageNum: 0 } });
          },
        }),
        (t.onLoadWearSkillData = {
          caller: t,
          code: 2021,
          method: function (e) {
            t.showWeableBlockLevel(2);
            var i;
            (t.dataSource = []), (t.skillListArr = e.list);
            for (var s = 0; s < e.list.length; s++)
              (i = {
                skill_name: { text: e.list[s].name },
                skill_userButton: { label: "选择" },
              }),
                t.dataSource.push(i);
            (t.list_wearSkill.dataSource = t.dataSource),
              (t.list_wearSkill.selectEnable = !0),
              t.list_wearSkill.on(
                Laya.Event.CLICK,
                t,
                t.onWearableUserDidClick
              );
          },
        }),
        (t.onLoadWearableResultDataFn = {
          caller: t,
          code: 2022,
          method: function (e) {
            0 != e.code
              ? ToastView.toastView(e.msg)
              : (ToastView.toastView(e.data),
                WebSocketService.send({ c: 1425, d: { pageNum: 0 } })),
              t.close();
          },
        }),
        (t.onLoadWearableXinFaFn = {
          caller: t,
          code: 2029,
          method: function (e) {
            if (0 == e.code) {
              var i;
              (t.dataSource = []), (t.wearListArr = e.list);
              for (var s = 0; s < e.list.length; s++)
                (i = {
                  wearablename: { text: e.list[s].name },
                  wearablebutton: { label: "选择" },
                }),
                  t.dataSource.push(i);
              e.list.length > 0
                ? ((t.lablel_wearable_empty.text = ""),
                  (t.lablel_wearable_empty.visible = !1))
                : ((t.lablel_wearable_empty.text = "没有合适的副将"),
                  (t.lablel_wearable_empty.visible = !0)),
                (t.list_wearableuser.dataSource = t.dataSource);
            }
          },
        }),
        WebSocketService.addListener({
          caller: t,
          code: 2015,
          method: t.onLoadWearExperienceData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 2020,
          method: t.onLoadWearableOneDataFn,
        }),
        WebSocketService.addListener(t.onLoadWearableSureDataFn),
        WebSocketService.addListener(t.onLoadWearableXinFaFn),
        WebSocketService.addListener({
          caller: t,
          code: 2030,
          method: t.onLoadWearableShiYongResultFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 4439,
          method: t.onLoadWearableShiYongResultFn,
        }),
        WebSocketService.addListener(t.onLoadWearSkillData),
        WebSocketService.addListener({
          caller: t,
          code: 2020,
          method: t.onLoadWearableOneDataFn,
        }),
        WebSocketService.addListener(t.onLoadWearableResultDataFn),
        WebSocketService.addListener({
          caller: t,
          code: 1123,
          method: t.onLoadLanBoQiuDataFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 6107,
          method: t.onLoadLanBoQiuDataFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 6108,
          method: t.onLoadLanBoQiuDataFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 2039,
          method: t.onLoadLanBoQiuDataFn,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 4438,
          method: t.onLoadWearExperienceData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 2036,
          method: t.onLoadWearableOneDataFn,
        }),
        t.list_wearableuser.on(Laya.Event.CLICK, t, t.onWearableUserDidClick),
        (t.list_wearableuser.selectEnable = !0),
        (t.list_wearableuser.vScrollBarSkin = ""),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showWearableShow = function (e, i) {
        if (
          (null == this.wearuserV &&
            ((this.wearuserV = new t()), (this.wearuserV.zOrder = 1500)),
          this.wearuserV.popup(!0),
          (this.wearuserV.lablel_wearable_empty.text = ""),
          (this.wearuserV.lablel_wearable_empty.visible = !1),
          (this.wearuserV.gid = e),
          (this.wearuserV.max = parseInt(i)),
          (this.wearuserV.slider_user_wearable.value = 1),
          "83" == e || "84" == e)
        )
          WebSocketService.send({ c: 2015, d: { gid: e, pageNum: 0 } });
        else if ("147" == e || "148" == e || "149" == e || "425" == e) {
          WebSocketService.send({ c: 2029, d: { gid: e, pageNum: 0 } }),
            (this.wearuserV.num = 1),
            (this.wearuserV.min = 1);
          s = 0;
          (s = this.wearuserV.max > 50 ? 50 : this.wearuserV.max),
            (this.wearuserV.slider_user_wearable.max = s),
            (this.wearuserV.slider_user_wearable.value = this.wearuserV.num),
            (this.wearuserV.max = parseInt(i));
        } else if (
          "302" == e ||
          "303" == e ||
          "304" == e ||
          "305" == e ||
          "306" == e
        ) {
          WebSocketService.send({ c: 4438, d: { pageNum: 0 } }),
            (this.wearuserV.num = 1),
            (this.wearuserV.min = 1);
          s = 0;
          (s = this.wearuserV.max > 10 ? 10 : this.wearuserV.max),
            (this.wearuserV.slider_user_wearable.max = s),
            (this.wearuserV.slider_user_wearable.value = this.wearuserV.num),
            (this.wearuserV.max = parseInt(i));
        } else if ("408" == e || "409" == e) {
          s = 0;
          (s = this.wearuserV.max > 50 ? 50 : this.wearuserV.max),
            (this.wearuserV.slider_user_wearable.max = s),
            WebSocketService.send({ c: 1123 });
        } else if (
          "131" == e ||
          "132" == e ||
          "133" == e ||
          "134" == e ||
          "135" == e
        ) {
          s = 0;
          (s = this.wearuserV.max > 50 ? 50 : this.wearuserV.max),
            (this.wearuserV.slider_user_wearable.max = s),
            WebSocketService.send({ c: 2020, d: { gid: e, pageNum: 0 } });
        } else if ("242" == e || "243" == e || "244" == e || "245" == e) {
          s = 0;
          (this.wearuserV.num = 0),
            (this.wearuserV.min = 0),
            (s = this.wearuserV.max > 50 ? 50 : this.wearuserV.max),
            (this.wearuserV.slider_user_wearable.max = s),
            WebSocketService.send({ c: 2036, d: { gid: e } });
        } else {
          var s = 0;
          (s = this.wearuserV.max > 50 ? 50 : this.wearuserV.max),
            (this.wearuserV.slider_user_wearable.max = s),
            WebSocketService.send({ c: 2015, d: { gid: e, pageNum: 0 } });
        }
        this.wearuserV.showWeableBlockLevel(1);
      }),
      (t.prototype.onLoadWearExperienceData = function (e) {
        if (0 == e.code) {
          2015 == e.act_id
            ? ((this.dataSource = []), (this.wearListArr = e.list))
            : 4438 == e.act_id &&
              ((this.dataSource = []), (this.wearListArr = e.list));
          for (var t, i = 0; i < e.list.length; i++)
            (t = {
              wearablename: { text: e.list[i].name },
              wearablebutton: { label: "选择" },
            }),
              this.dataSource.push(t);
          e.list.length > 0
            ? ((this.lablel_wearable_empty.text = ""),
              (this.lablel_wearable_empty.visible = !1))
            : ((this.lablel_wearable_empty.text = "没有合适的副将"),
              (this.lablel_wearable_empty.visible = !0)),
            (this.list_wearableuser.dataSource = this.dataSource);
        }
      }),
      (t.prototype.showWeableBlockLevel = function (e) {
        1 == e
          ? ((this.list_wearableuser.visible = !0),
            (this.title_wearableName.text = "选择副将"),
            (this.label_userCell.text = ""),
            (this.list_wearSkill.visible = !1),
            this.initUserNumberView(!1))
          : 2 == e
          ? ((this.list_wearableuser.visible = !1),
            (this.label_userCell.text = ""),
            (this.list_wearSkill.visible = !0),
            (this.title_wearableName.text = "选择技能"),
            this.initUserNumberView(!1))
          : 3 == e &&
            ((this.list_wearableuser.visible = !1),
            (this.list_wearSkill.visible = !1),
            "jingshu" == this.goods_type
              ? (this.title_wearableName.text = "确定选择经验")
              : (this.title_wearableName.text = "确定使用个数"),
            this.initUserNumberView(!0));
      }),
      (t.prototype.initUserNumberView = function (e) {
        (this.btn_user_dele.visible = e),
          (this.btn_user_plus.visible = e),
          (this.btn_user_cancle.visible = e),
          (this.btn_user_sure.visible = e),
          (this.slider_user_wearable.visible = e),
          (this.label_userCell.text = "个"),
          (this.label_user_number.text = "1"),
          1 == e &&
            (this.btn_user_sure.on(
              Laya.Event.CLICK,
              this,
              this.onQueDingUserDidClickFn
            ),
            this.btn_user_plus.on(
              Laya.Event.CLICK,
              this,
              this.onUserXinFaPlusDidClick
            ),
            this.btn_user_dele.on(
              Laya.Event.CLICK,
              this,
              this.onUserXinFaPlusDidClick
            ),
            this.slider_user_wearable.on(
              Laya.Event.CHANGE,
              this,
              this.sliderChange
            ),
            this.btn_user_cancle.on(
              Laya.Event.CLICK,
              this,
              this.onUserDidCancleFn
            ));
      }),
      (t.prototype.onQueDingUserDidClickFn = function () {
        if ("jineng_shu" == this.goods_type) {
          var e = this.skillListArr[this.list_wearSkill.selectedIndex].id;
          WebSocketService.send({
            c: 2022,
            d: { gid: this.gid, cid: this.user_cid, sid: e, c: this.num },
          });
        } else if ("jingyan_shu" == this.goods_type) {
          t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
          (this.user_cid = t),
            WebSocketService.send({ c: 2016, d: { gid: this.gid, cid: t } });
        } else if ("changren_xinfa" == this.goods_type) {
          t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
          (this.user_cid = t),
            WebSocketService.send({
              c: 4439,
              d: { gid: this.gid, cid: t, c: this.num },
            });
        } else if ("changren_mizong" == this.goods_type) {
          t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
          (this.user_cid = t),
            WebSocketService.send({
              c: 2030,
              d: { gid: this.gid, cid: t, c: this.num },
            });
        } else if ("jingshu" == this.goods_type) {
          t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
          (this.user_cid = t),
            WebSocketService.send({ c: 1906, d: { cid: t, exp: 100 } });
        } else {
          var t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
          (this.user_cid = t),
            WebSocketService.send({
              c: 2030,
              d: { gid: this.gid, cid: t, c: this.num },
            });
        }
        this.goods_type = "";
      }),
      (t.prototype.onUserXinFaPlusDidClick = function (e) {
        "item1" == e.target.name
          ? ((this.num = this.num + this.step),
            this.num > this.max && (this.num = this.max),
            (this.slider_user_wearable.value = this.num))
          : ((this.num = this.num - this.step),
            this.num < this.min && (this.num = this.min),
            (this.slider_user_wearable.value = this.num)),
          (this.label_user_number.text = this.num + "");
      }),
      (t.prototype.sliderChange = function () {
        (this.num = this.slider_user_wearable.value),
          (this.label_user_number.text = this.num + "");
      }),
      (t.prototype.onLoadWearableOneDataFn = function (e) {
        if (0 == e.code) {
          var t;
          if (
            ((this.dataSource = []),
            (this.wearListArr = e.list),
            2036 == e.act_id)
          ) {
            for (i = 0; i < e.list.length; i++)
              (t = {
                wearablename: {
                  text:
                    e.list[i].lvl + "级" + e.list[i].name + e.list[i].v + "点",
                },
                wearablebutton: { label: "选择" },
              }),
                this.dataSource.push(t);
            (this.label_user_number.text = "清洗" + e.more),
              (this.label_userCell.text = "");
          } else
            for (var i = 0; i < e.list.length; i++)
              (t = {
                wearablename: { text: e.list[i].name },
                wearablebutton: { label: "选择" },
              }),
                this.dataSource.push(t);
          this.list_wearableuser.dataSource = this.dataSource;
        }
      }),
      (t.prototype.onLoadWearableShiYongResultFn = function (e) {
        ToastView.toastView(e.msg),
          WebSocketService.send({ c: 1425, d: { pageNum: 0 } }),
          this.close();
      }),
      (t.prototype.onWearableUserDidClick = function (e) {
        if ("" != e.target.name)
          if ("83" == this.gid || "84" == this.gid) {
            t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
            (this.user_cid = t),
              WebSocketService.send({ c: 2016, d: { gid: this.gid, cid: t } });
          } else if ("wearablebutton" == e.target.name)
            if (
              "147" == this.gid ||
              "148" == this.gid ||
              "149" == this.gid ||
              "452" == this.gid
            )
              this.showWeableBlockLevel(3);
            else if ("131" == this.gid) {
              t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
              (this.user_cid = t),
                WebSocketService.send({
                  c: 2021,
                  d: { gid: this.gid, cid: t, pageNum: 0 },
                });
            } else if ("408" == this.gid) {
              t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
              (this.user_cid = t),
                WebSocketService.send({ c: 6107, d: { cid: t } });
            } else if ("409" == this.gid) {
              t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
              (this.user_cid = t),
                WebSocketService.send({ c: 6108, d: { cid: t } });
            } else if (
              "302" == this.gid ||
              "303" == this.gid ||
              "304" == this.gid ||
              "305" == this.gid ||
              "306" == this.gid
            ) {
              t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
              (this.user_cid = t),
                (this.goods_type = "changren_xinfa"),
                this.showWeableBlockLevel(3);
            } else if ("425" == this.gid) {
              t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
              (this.user_cid = t),
                (this.goods_type = "changren_mizong"),
                this.showWeableBlockLevel(3);
            } else if (
              "242" == this.gid ||
              "243" == this.gid ||
              "244" == this.gid ||
              "245" == this.gid
            ) {
              t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
              (this.user_cid = t),
                WebSocketService.send({
                  c: 2039,
                  d: { gid: this.gid, cid: t },
                });
            } else {
              var t = this.wearListArr[this.list_wearableuser.selectedIndex].id;
              (this.user_cid = t),
                WebSocketService.send({
                  c: 2021,
                  d: { gid: this.gid, cid: t, pageNum: 0 },
                });
            }
          else
            "skill_userButton" == e.target.name &&
              ((this.goods_type = "jineng_shu"), this.showWeableBlockLevel(3));
      }),
      (t.prototype.onLoadLanBoQiuDataFn = function (e) {
        if (0 == e.code)
          if ("1123" == e.act_id) {
            var t = void 0;
            (this.dataSource = []), (this.wearListArr = e.list);
            for (var i = 0; i < e.list.length; i++)
              (t = {
                wearablename: { text: e.list[i].name },
                wearablebutton: { label: "选择" },
              }),
                this.dataSource.push(t);
            e.list.length > 0
              ? ((this.lablel_wearable_empty.text = ""),
                (this.lablel_wearable_empty.visible = !1))
              : ((this.lablel_wearable_empty.text = "没有合适的副将"),
                (this.lablel_wearable_empty.visible = !0)),
              (this.list_wearableuser.dataSource = this.dataSource);
          } else
            "6107" == e.act_id
              ? (ToastView.toastView(e.msg),
                WebSocketService.send({ c: 1425, d: { pageNum: 0 } }))
              : "6108" == e.act_id
              ? (ToastView.toastView(e.msg),
                WebSocketService.send({ c: 1425, d: { pageNum: 0 } }))
              : "2039" == e.act_id &&
                (ToastView.toastView(e.msg),
                WebSocketService.send({ c: 1425, d: { pageNum: 0 } }),
                WebSocketService.send({ c: 2036, d: { gid: this.gid } }));
        else ToastView.toastView(e.msg);
      }),
      (t.prototype.onUserDidCancleFn = function () {
        this.close();
      }),
      (t.close = function () {
        this.wearuserV && (this.wearuserV.close(), (this.wearuserV = null));
      }),
      t
    );
  })(ui.TabBarItemController.WearableUsedDialogUI);
